import {Fragment, PureComponent} from 'react';
import {createPortal} from "react-dom";

export class PortalsDemo extends PureComponent {
    render() {
        return (
            <Fragment>
                <h1>PortalsDemo</h1>
                <Model>
                    <h2>My name is Model</h2>
                </Model>
            </Fragment>
        )
    }
}

class Model extends PureComponent {
    render() {
        return createPortal(
            <div>
                {this.props.children}
            </div>, document.getElementById("model")
        )
    }
}